Jump to content

Flashing a Yocto image

From RidgeRun Developer Wiki


Follow us on: YouTube Twitter LinkedIn Email Share this page

Share This Page




Flash software images

Obtain flashable binaries

Go to the working directory and remember to set the environment variables:

IMAGE=qcom-multimedia-proprietary-image
MACHINE=iq-9075-evk
WORKSPACE_DIR=${HOME}
cd $WORKSPACE_DIR

After build completion, flashable images can be obtained from the following paths:

1. The qcomflash:

$WORKSPACE_DIR/build/tmp/deploy/images/$MACHINE/$IMAGE-$MACHINE.rootfs.qcomflash

Example:

~/build/tmp/deploy/images/iq-9075-evk/qcom-multimedia-proprietary-image-iq-9075-evk.rootfs.qcomflash

2. The qcomflash.tar.gz:

$WORKSPACE_DIR/build/tmp/deploy/images/$MACHINE/$IMAGE-$MACHINE.rootfs.qcomflash.tar.gz

Example:

~/build/tmp/deploy/images/iq-9075-evk/qcom-multimedia-proprietary-image-iq-9075-evk.rootfs.qcomflash.tar.gz

Copy the image to the workspace directory in the Host Computer. For this example the working directory is ~/dragonwing

HOST_DIRECTORY=~/dragonwing 
mkdir $HOST_DIRECTORY
cd $HOST_DIRECTORY

In this case the image was built in a virtual machine, so to copy to working directory use:

VM_USER=user
VM_IP_ADDRESS=X.X.X.X
scp $VM_USER@$VM_IP_ADDRESS:$WORKSPACE_DIR/build/tmp/deploy/images/$MACHINE/$IMAGE-$MACHINE.rootfs.qcomflash.tar.gz $HOST_DIRECTORY

After copying the .rootfs.qcomflash.tar.gz file of the image in the working directory, run:

tar -xvf $IMAGE-$MACHINE.rootfs.qcomflash.tar.gz
This example is for the proprietary image, copy the corresponding image file

Flash instructions

Follow these steps to flash the software images:

  1. Update the udev rules (one-time prerequisite).
  2. Force the device into emergency download (EDL) mode.
  3. Install QDL.
  4. Provision UFS (one-time prerequisite).
  5. Flash SAIL (one-time prerequisite).
  6. Choose CDT based on reference kit.
  7. Flash the software

1. Update udev rules (one-time prerequisite)

Go to the udev USB rules directory:

cd /etc/udev/rules.d

List the contents of the directory using ls. If the 51-qcom-usb.rules file isn't present, please create it with:

sudo vi 51-qcom-usb.rules

And add the following content (if file exists, check contents to match):

SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0666", GROUP="plugdev"

Restart udev:

sudo systemctl restart udev

If the USB cable is already connected to the host, unplug and reconnect the cable for the updated rules to take effect.


2. Force device into EDL mode

Make sure the USB-C cable is connected in USB0 (ADB). Put the device into Emergency Download (EDL) mode before flashing. To do it manually:

  • Put the device in EDL mode by turning on the DIP switch SW2-3.
  • Verify if the device is in EDL mode with lsusb. If the output says QDL mode, the device is in EDL mode:
Bus 002 Device 014: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)
Dragonwing S2-3 DIP switch.

3. Install QDL

Download the Qualcomm Device Loader (QDL). QDL is a software tool that communicates with the Qualcomm USB devices to upload a flash loader and flash software images. You can do it from Qualcomm Software Center or using CLI:

# Linux X64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/Linux/Debian/latest.zip
# Linux ARM64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/Linux/ARM64/Debian/latest.zip
# macOS X64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/macOS/latest.zip
# macOS ARM64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/macOS/ARM64/latest.zip

Unzip it:

unzip latest.zip

Save the path of the files:

QDL_PATH=~/dragonwing/QDL_2.5_Linux_x64/

And give it executable permission:

chmod -R 777 $QDL_PATH
Example to install qdl in ~/dragonwing folder:
cd $HOST_DIRECTORY
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/Linux/Debian/latest.zip
unzip latest.zip
chmod -R 777 QDL_2.5_Linux_x64/

4. Provision UFS (one-time prerequisite)

Universal flash storage (UFS) provisioning helps to divide the storage into many LUNs, which stores different types of data separately. This improves access efficiency and system organization. Download the correct one from the UFS Provision table of the Release Notes.

cd $HOST_DIRECTORY
wget https://artifacts.codelinaro.org/artifactory/codelinaro-le/Qualcomm_Linux/QCS9100/provision.zip
unzip provision.zip -d provision
cd provision
 $QDL_PATH/qdl --storage ufs prog_firehose_ddr.elf provision_1_2.xml
At this stage the board needs to be connected to Host PC through USB-C cable

5. Flash SAIL (one-time prerequisite)

To flash the SAIL:

cd $HOST_DIRECTORY/$IMAGE-$MACHINE/sail_nor/
$QDL_PATH/qdl --storage spinor prog_firehose_ddr.elf rawprogram0.xml patch0.xml

Succesful result:

waiting for programmer...
flashed "SAIL_HYP" successfully
flashed "SAIL_SW1" successfully
flashed "SAIL_HYP_BKUP" successfully
flashed "SAIL_SW1_BKUP" successfully
flashed "PrimaryGPT" successfully
flashed "BackupGPT" successfully
11 patches applied

6. Flash software using QDL

Some Linux distributions include the ModemManager tool, which allows you to configure the mobile broadband. When a device is connected in USB mode, it's identified as a Qualcomm modem, and ModemManager attempts to configure it. Because this interferes with the QDL flashing, you must disable the ModemManager before connecting your device. If you are using a Linux distribution with systemd, stop the ModemManager tool using the following command:

sudo systemctl stop ModemManager

Flash images:

cd $HOST_DIRECTORY/$IMAGE-$MACHINE/

# For UFS storage
$QDL_PATH/qdl --storage ufs prog_firehose_ddr.elf rawprogram*.xml patch*.xml

# For eMMC storage
$QDL_PATH/qdl --storage emmc prog_firehose_ddr.elf rawprogram0.xml patch0.xml

Successful flashing output:

...
flashed "multiimgoem_b" successfully
flashed "multiimgqti_b" successfully
flashed "imagefv_b" successfully
flashed "toolsfv" successfully
flashed "PrimaryGPT" successfully
flashed "BackupGPT" successfully
flashed "PrimaryGPT" successfully
flashed "BackupGPT" successfully
78 patches applied
partition 1 is now bootable
Example to flash SAIL from ~/dragonwing folder:
cd $HOST_DIRECTORY/$IMAGE-$MACHINE/
$QDL_PATH/qdl --storage ufs prog_firehose_ddr.elf rawprogram*.xml patch*.xml

Verify flashing

lsusb

Example output:

Bus 002 Device 003: ID 05c6:9135 Qualcomm, Inc.

The device reboots automatically after flashing.

Remember to take the device out of EDL mode and restart it.
It is recommended to connect the flashing USB-C cable directly to the host computer. Hubs and adapters might lead to issues when flashing.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.